/**
 * ref 回调函数表示形式 『了解』
 */
import React, { Component } from 'react'

export default class RefCom2 extends Component {
  render() {
    return (
      <div>
        <input type="text" ref={(el) => {
          this.input = el;
        }} /> <button onClick={this.show}>显示</button>
        <hr />
        <div ref={el => this.result = el} style={{width: 400, height: 300, border:'solid 1px #666'}}></div>
      </div>
    )
  }
  //单击事件的回调
  show = () => {
    //获取input元素的值
    let v = this.input.value;
    //设置
    this.result.innerHTML = v;
  }
}
